<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
<h:outputStylesheet library="css" name="default.css" target="head" />
	<title>Visualizza Pacchetti Client</title>
</h:head>
<h:body>
<h:form>
<p:toolbar style="heigh:35px; margin-bottom:25px" id="tb">
		<p:toolbarGroup align="left" style="margin-top:5px; margin-left:10px" id="tools">
		Utente #{userBean.name} <p:separator/> #{userBean.mail}
		
		</p:toolbarGroup>
		<p:toolbarGroup align="right">		
			<p:menuButton value="Opzioni">
					<p:menuitem value="Home" url="index.xhtml" icon="ui-icon-home" />
					<p:menuitem value="Visualizza Carrello" outcome="show_carrello.xhtml" icon="ui-icon-cart" />
					<p:menuitem value="Mostra Prenotazioni" outcome="show_prenotati.xhtml" icon="ui-icon-tag" />
			</p:menuButton>
		<p:separator/>
		<p:commandButton action="#{logBean.logout}" value="Logout" icon="ui-icon-power" />
		</p:toolbarGroup>
	</p:toolbar>
	</h:form>
<h:form id="form">

	<p:dataGrid var="pack" value="#{packPresBean.getPubPackages()}" columns="3"  
        rows="12" paginator="true"  
        paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
        rowsPerPageTemplate="9,12,15">  
  
        <p:panel header="#{pack.IDPacchetto}" style="text-align:center">  
            <h:panelGrid columns="1" style="width:100%">  
                <p:commandLink update=":form:packDetail" oncomplete="PF('packDialog').show()" title="View Detail">  
                    <h:outputText styleClass="ui-icon ui-icon-search" style="margin:0 auto;" />   
                    <f:setPropertyActionListener value="#{pack}" target="#{packPresBean.pacchetto}" />  
                </p:commandLink> 
            </h:panelGrid>  
        </p:panel>  
  
    </p:dataGrid>  
      
    
     <p:dialog header="Pacchetto" widgetVar="packDialog" modal="true">  
        <p:outputPanel id="packDetail" style="text-align:center;">   
              
            <h:panelGrid  columns="2" cellpadding="5"> 
            	<h:outputLabel for="name" value="Nome: " />  
                <h:outputText id="name" value="#{packPresBean.pacchetto.nome}" />  
            	
                <h:outputLabel for="modelNo" value="Descrizione: " />  
                <h:outputText id="modelNo" value="#{packPresBean.pacchetto.descrizione}" />  
             
                <h:outputLabel for="year" value="ID: " />  
                <h:outputText id="year" value="#{packPresBean.pacchetto.IDPacchetto}" />  
                <p:dataTable var="pkHotel" value="#{packPresBean.pacchetto.ponteHotel}">  
			        <p:column headerText="ID">  
			            <h:outputText value="#{pkHotel.hotel.ID}" />  
			        </p:column>  
			         <p:column headerText="nome">  
			            <h:outputText value="#{pkHotel.hotel.nome}" />  
			        </p:column>   
			        <p:column headerText="Loc">  
			            <h:outputText value="#{pkHotel.hotel.localita.nome}" />  
			        </p:column>
			    </p:dataTable>
			    
			     <p:dataTable var="pkTour" value="#{packPresBean.pacchetto.ponteTour}">  
			        <p:column headerText="ID">  
			            <h:outputText value="#{pkTour.tour.ID}" />  
			        </p:column>  
			         <p:column headerText="nome">  
			            <h:outputText value="#{pkTour.tour.descrizione}" />  
			        </p:column>   
			        <p:column headerText="Loc">  
			            <h:outputText value="#{pkTour.tour.localita.nome}" />  
			        </p:column>
			    </p:dataTable>
			    
			    <p:dataTable var="pkVolo" value="#{packPresBean.pacchetto.ponteVolo}">  
			        <p:column headerText="ID">  
			            <h:outputText value="#{pkVolo.trattaVolo.daAeroporto.name}" />  
			        </p:column>  
			         <p:column headerText="nome">  
			            <h:outputText value="#{pkVolo.trattaVolo.aAeroporto.name}" />  
			        </p:column>   
			        <p:column headerText="Loc">  
			            <h:outputText value="#{pkVolo.trattaVolo.compagnia.nome}" />  
			        </p:column>
			    </p:dataTable>
			    
			     <h:panelGrid  columns="2">
			    <p:button outcome="PackagesDetail" value="Visualizza dettagli" >  
				   <!-- <f:param name="productId" value="10" />   --> 
				</p:button> <br/>
				  <p:button outcome="show_pacchetto_utente.xhtml?ID=#{packPresBean.pacchetto.IDPacchetto}" value="Invia a un amico" >  
				    
				</p:button>  
				</h:panelGrid>
			 </h:panelGrid>   
        </p:outputPanel>  
    </p:dialog>   
   

</h:form>
</h:body>
</html>